/**
 *
 */
package com.angel.data.generator.checkers;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.angel.data.generator.exceptions.DataGeneratorCheckerException;
import com.angel.data.generator.interfaces.DataGenerator;
import com.angel.data.generator.repository.DataGeneratorRepository;

/**
 * @author William
 *
 */
public class DataGeneratorCheckerRunner {

	private List<DataGeneratorChecker> checkers;

	public DataGeneratorCheckerRunner(){
		this(new ArrayList<DataGeneratorChecker>());
	}

	public DataGeneratorCheckerRunner(List<DataGeneratorChecker> checkers){
		super();
		this.checkers = checkers;
	}

	public boolean addChecker(DataGeneratorChecker checker){
		return this.checkers.add(checker);
	}

	public boolean removeChecker(DataGeneratorChecker checker){
		return this.checkers.remove(checker);
	}

	public boolean containsChecker(DataGeneratorChecker checker){
		return this.checkers.contains(checker);
	}

	public boolean addAllChecker(Collection<DataGeneratorChecker> checkers){
		return this.checkers.addAll(checkers);
	}

	public void checkDataGenerator(DataGenerator dataGenerator, DataGeneratorRepository dataGeneratorRepository) throws DataGeneratorCheckerException{
		for(DataGeneratorChecker checker: this.checkers){
			checker.checkDataGenerator(dataGenerator, dataGeneratorRepository);
		}
	}

	/**
	 * @return the checkers
	 */
	public List<DataGeneratorChecker> getCheckers() {
		return checkers;
	}

}
